package io.rehuo.modules.app.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.rehuo.modules.app.dao.IndexApplyProductDao;
import io.rehuo.modules.app.entity.IndexApplyProductEntity;
import io.rehuo.modules.app.service.IndexApplyProductService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author shiguang on 2022/9/16 11:14
 */
@Service("indexApplyProductService")
public class IndexApplyProductServiceImpl extends ServiceImpl<IndexApplyProductDao, IndexApplyProductEntity> implements IndexApplyProductService {

    @Override
    public List<IndexApplyProductEntity> getList() {
        return baseMapper.selectList(new QueryWrapper<IndexApplyProductEntity>().orderByAsc("apply_money"));
    }

    @Override
    public IndexApplyProductEntity getByMoney(Integer applyMoney) {
        return baseMapper.selectOne(new QueryWrapper<IndexApplyProductEntity>().eq("apply_money",applyMoney).orderByDesc("id").last("limit 1"));
    }
}
